<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace="RStaffRoles" xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<alias>
    <typeAlias alias="RStaffRoles" type="EIA.PM.Model.RStaffRoles, EIA.PM.Model" />
</alias>

<resultMaps>
<resultMap id="select-rstaffroles-result" class="RStaffRoles">
<constructor>
    <argument argumentName="stf_id" column="stf_id"/>
    <argument argumentName="role_id" column="role_id"/>
</constructor>
<!--
    <result property="StfId" column="stf_id"/>
    <result property="RoleId" column="role_id"/>
-->
</resultMap>
</resultMaps>

<statements>
<sql id="sql_RStaffRoles_where_pk">
WHERE stf_id=#StfId# AND role_id=#RoleId#
</sql>

<sql id="sql_RStaffRoles_where_cv">
<dynamic prepend="WHERE">
    <isPropertyAvailable property="StfId" prepend="AND">stf_id=#StfId#</isPropertyAvailable>
    <isPropertyAvailable property="RoleId" prepend="AND">role_id=#RoleId#</isPropertyAvailable>
</dynamic>
</sql>

<sql id="sql_RStaffRoles_set_cols">
<dynamic prepend="SET">
</dynamic>
</sql>

<select id="SelectRStaffRoles" parameterClass="" resultMap="RStaffRoles.select-rstaffroles-result">
SELECT *
FROM r_staff_roles
<include refid="sql_RStaffRoles_where_pk"/><!--where-->
</select>

<select id="SelectRStaffRoles_CV" parameterClass="System.Collections.IDictionary" resultMap="RStaffRoles.select-rstaffroles-result">
SELECT *
FROM r_staff_roles
<include refid="sql_RStaffRoles_where_cv"/><!--where-->
</select>

<insert id="InsertRStaffRoles" parameterClass="RStaffRoles">
<!--pre selectKey place-->
INSERT INTO r_staff_roles(
<dynamic prepend=" ">stf_id,role_id
</dynamic>
)VALUES(
<dynamic prepend=" ">#StfId#,#RoleId#
</dynamic>
)
<!--post selectKey place-->
</insert>

<!--only pk, there is no need to update-->

<delete id="DeleteRStaffRoles" parameterClass="">
DELETE FROM r_staff_roles
<include refid="sql_RStaffRoles_where_pk"/><!--where-->
</delete>

<statement id="DeleteRStaffRoles_CV" parameterClass="RStaffRoles">
DELETE FROM r_staff_roles
<include refid="sql_RStaffRoles_where_cv"/><!--where-->
</statement>

<delete id="ClearRStaffRoles">
DELETE FROM r_staff_roles
</delete>
</statements>
</sqlMap>